package com.android.djlmapp.activity.home.web;

import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;

import com.android.djlmapp.R;
import com.android.djlmapp.base.BaseActivity;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by wa on 2017/2/19.
 */
public class ZxingWebActivity extends BaseActivity {


    @BindView(R.id.webviewframe)
    WebView webviewframe;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_zxingweb);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//禁止横竖屏切换
        ButterKnife.bind(this);
        initView();
        initData();
    }

    @Override
    protected void initView() {
        initWeb();
    }

    @Override
    protected void initData() {
        String result = getIntent().getStringExtra("result");
        webviewframe.loadUrl(result);
    }

    private void initWeb() {
        WebSettings webSettings = webviewframe.getSettings();
        webSettings.setGeolocationEnabled(true);
        webSettings.setDomStorageEnabled(true);
        webSettings.setDefaultTextEncodingName("utg-8");
        webSettings.setJavaScriptEnabled(true);
    }
}
